<template>
  <div class="app-container">
    <el-breadcrumb separator="/" class="breadcrumb2">
      <el-breadcrumb-item>签到模板</el-breadcrumb-item>
    </el-breadcrumb>

    <el-card class="righttable">
      <i class="el-icon-tickets"></i>
      <span>签到模板列表</span>
      <el-table
        :data="signData"
        border
        stripe
        style="width: 100%"
        :default-sort="{ prop: 'date', order: 'descending' }"
      >
        <el-table-column type="index" align="center" width="50"></el-table-column>
        <el-table-column prop="name" label="模板名称" align="center">
          <template slot-scope="scope">
            <p>{{ scope.row.name }}</p>
          </template>
        </el-table-column>
        <el-table-column prop="address" width="200" label="操作" align="center">
          <template slot-scope="scope">
            <el-button type="primary" size="mini" @click="gotosignlist(scope.row)"
              >查看签到活动</el-button
            >
          </template>
        </el-table-column>
      </el-table>
      <!-- <div class="pagination-container">
        <el-pagination
          background
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          layout="total, sizes, prev, pager, next,jumper"
          :current-page.sync="formInline.pageNum"
          :page-size="formInline.pageSize"
          :page-sizes="[5, 10, 15]"
          :total="total"
        ></el-pagination>
      </div> -->
    </el-card>
  </div>
</template>

<script>
const defaultFormInline = {
  pageNum: 1,
  pageSize: 5,
  university: null,
  academy: null,
  name: null,
}
export default {
  name: 'signList',
  data() {
    return {
      signData: [],
      // formInline: {
      //   university: '',
      //   academy: '',
      //   name: '',
      //   pageNum: 1,
      //   pageSize: 5,
      // },
      // total: 0,
      uid: null,
      // 分页
    }
  },
  created() {
    this.uid = window.sessionStorage.getItem('uid')
    this.selectList()
  },
  mounted: function () {},
  methods: {
    // // 实现分页
    // // 更改了每页大小
    // handleSizeChange(val) {
    //   this.formInline.pageNum = 1
    //   this.formInline.pageSize = val
    //   // 请求对应的分页数据
    //   this.selectList()
    // },
    // // 更改了第几页
    // handleCurrentChange(val) {
    //   this.formInline.pageNum = val
    //   // console.log('更改页数', this.formInline.PageNum)
    //   this.selectList()
    // },

    // 查询签到活动
    async selectList() {
      const { data: res } = await this.$http.get('/template/getList', {
        params: {
          uid: this.uid,
          // pageNum: this.formInline.pageNum,
          // pageSize: this.formInline.pageSize,
        },
      })
      if (res != null) {
        console.log('111', res)
        this.signData = res.data
        // this.total = res.total
      }
    },
    gotosignlist(data) {
      window.sessionStorage.setItem("templateId",data.id)
      this.$router.push('/signtemp/signlist')
    },
  },
}
</script>

<style>
body {
  padding-right: 0px !important;
  overflow: hidden;
}
.app-container {
  width: 100%;
  height: 100%;
}
.input-width {
  width: 203px;
}
.home-breadcrumb {
  position: relative;
  top: -52px;
  left: 29px;
}
</style>
